#ifndef __MYSQLMANAGER_H__
#define __MYSQLMANAGER_H__


#include<iostream>
#include<string>
#include <mysql/mysql.h> 
using namespace std;



struct ReginstInfo
{
    char            name[64];
    char            passwd[32];
    char            phone[11];
    char            email[64];
};

struct LoginInfo
{
    char            name[64];
    char            passwd[32];
};

enum class TallyType: char
{
    TT_INCOME,      // 收入
    TT_EXPEND       // 支出
};

struct TallyInfo
{
    TallyType       type;       // 记录类型
    float           money;      // 记录金额
    char            account[64];// 账户类型，现金、xx 银行卡、微信、支付宝...
    char            useage[128];// 收支用途：吃饭、买衣服、买零食、医疗、电子产品...
    time_t          time;       // 收支时间
};

class SqlManager
{
private:
    MYSQL * con;
    /* data */
public:
    SqlManager(/* args */);
    ~SqlManager();
    bool SqlQueryUser(char name [64]);
    bool SqlUserRegist(ReginstInfo info);
    bool passwd_cmp (LoginInfo info_tocmp);
    bool SqlTallyRecord(TallyInfo info);

private:
    class Imple;
    Imple *impl;
};

#endif //__MYSQLMANAGER_H__